package org.graduates.webapp.actions.person.json;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.graduates.webapp.actions.BaseAction;
import org.projects.graduates.domain.Person;

/**
 * 根据ID得到人的具体信息
 * 
 * @author Administrator
 * 
 */
@Action(results = { @Result(name = "success", type = "json") })
public class GetPersonOfAction extends BaseAction {

	private static final long serialVersionUID = 1329773582052196222L;

	private long pid = 0L;

	private Person person;

	private String error = "";

	public String execute() {

		if (0L == pid) {
			return SUCCESS;
		}

		person = Person.get(Person.class, pid);

		if (null == person) {
			error = "没有此人哦";
			return SUCCESS;
		}
		
		return SUCCESS;
	}

	public long getPid() {
		return pid;
	}

	public void setPid(long pid) {
		this.pid = pid;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public String getError() {
		return error;
	}

}
